package service;

import dao.BookList;
import view.BookMenuView;

import java.util.Scanner;

/**
 * @Description TODO
 * @Author hhy
 * @Date 2020/9/17 13:37
 */
public class ReturnBookService {
    BookList bookList = BookList.getInstance();
    public void returnBook(){
        Scanner sc = new Scanner(System.in);
        System.out.println("下面是你的书。请选择你要还哪一本书");
        bookList.myBorrowBook();
        int returnBookId = sc.nextInt(); //选择哪一本书
        bookList.returnBook(returnBookId); //还书
        System.out.println();
        if (!bookList.myBorrowBookNum()){
            System.out.println("所有的书都还完了QAQ");
            new BookMenuView().view();
        }else {
            System.out.println("请问您还要继续还书吗(y/n)");
            String returnBookOK = sc.next();
            if (returnBookOK.equals("y")){
                returnBook();
            }
            new BookMenuView().view();
        }

    }
}
